package com.tyk.bookstore.front.order.model.vo;


import com.tyk.bookstore.front.common.core.util.FileUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author tyk
 * @description 订单创建Vo
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderCreateVo {

    @Schema(description = "流水号")
    private String tradeNo;

    @Schema(description = "订单详情列表")
    private List<OrderDetailVo> detailList;

    @Data
    public static class OrderDetailVo {
        @Schema(description = "书籍ID")
        private Long bookId;
        @Schema(description = "书籍编号")
        private String bookNo;
        @Schema(description = "书籍封面")
        private String cover;
        @Schema(description = "书籍标题")
        private String title;
        @Schema(description = "书籍价格")
        private BigDecimal price;
        @Schema(description = "书籍重量")
        private Long weight;
        @Schema(description = "购买数量")
        private Long num;
        public OrderDetailVo setCover(String cover) {
            this.cover = FileUtil.fullFilePath(cover);
            return this;
        }
    }
}
